package org.junv;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet("/DelUser")
public class DelUser extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
 
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		String username = request.getParameter("username");
		String sql="delete from userInfo where username='"+username+"'";
		System.out.println("进入servlet.........");
		DBBean myBean = new DBBean();
		myBean.init();
		if(myBean.executeUpdate(sql)){
			out.println("删除成功！");
			response.sendRedirect("manageUser.html");
		}else{
			out.println("删除失败！！");
			System.out.println("删除失败。。。。。。。");
			myBean.colse();
		}
		myBean.colse();
	}

	

}
